<style type="text/css">
.storelogo img{width:3.2rem;height:3.2rem}
.merchgroup .store-star {padding:0.1rem 0 0.2rem 0;font-size:0.55rem;line-height:1rem}
.merchgroup .store-star img{height:0.66rem}
.star-on,.star-off{position:absolute;top:1rem;left:0;overflow:hidden}
.star-rate {margin-left:3.6rem}
.store-distance{float:right;color:#999}
.store-moneylimit{font-size:0.55rem}
.syscolor{color:#cdab6a}
.sysbgcolor{background-color:#cdab6a}
.jyui_cell_col .colchecked{background:#cdab6a;}
.weui_cells_radio .weui_check:checked + .weui_icon_checked:before {;
  color: #cdab6a;
}
.weui_cells_radio2 .weui_check:checked + .weui_icon_checked:before {
  color: #cdab6a;
}
.weui_cells_radio3 .weui_check:checked + .weui_icon_checked:before {
    color: #cdab6a;
}
.yuyue-duan {border: 1px solid #cdab6a;}
.timeischack{background:#cdab6a;}
.weui_btn_primary {
  background-color: #cdab6a;
}

</style>
<div class="fui-page order-create-page fui-page-current" ng-if="pagedata.op == 'list'">
	<div class="fui-content">
		<div id="carousel-container" class="carousel slide" data-role="carousel" data-param-auto="true">
			<div class="carousel-inner" role="listbox" style="height:6rem">
			<div ng-class="{'item':1,'active':$index==0}" ng-repeat="item in pagedata.pluginset.hdps">
				<a href="#">
					<img src="{{tomedia(item.picurl) || '../core/resource/images/banner-1.jpg'}}" style="display: block; width: 100%; height: 100%;">
				</a>
			</div>
			</div>
			<style>
					.fui-swipe-page .fui-swipe-bullet {background: {background}; opacity: {opacity};}
					.fui-swipe-page .fui-swipe-bullet.active {opacity: 1;}
			</style>
			<div id="carousel-jinyun" class="fui-swipe-page" style="padding: 0 5px; bottom: 10px; ">
				<div class="fui-swipe-bullet" ng-repeat="item in pagedata.pluginset.hdps" ng-class="{'active':$index==0}" data-target="#carousel-container" data-slide-to="{{$index}}"></div>
			</div>
		</div>
		<div class="fui-list-group merchgroup" style="margin-top:0" ng-repeat="item in pagedata.serve_list">
            <div class="fui-list">
                <a class="fui-list-media storelogo" href="javascript:;" ng-click="access_json('jy_meye/server/sever_detail/id='+item.serve_id)">
                    <img class="round" ng-src="{{tomedia(item.image) || '../core/resource/images/nopic.jpg'}}">
                </a>
                <a class="fui-list-inner" style="margin-top:0.16rem" href="javascript:;" ng-click="access_json('jy_meye/server/sever_detail/id='+item.serve_id)">
                    <div class="title" style="font-size:0.76rem">{{item.title}}</div>
                    <div class="store-star">
						<span class="star-on"> <img src="../core/resource/images/star-off.png"></span>
						<span class="star-off" style="width: 88%;"> <img src="../core/resource/images/star-on.png"></span>
						<span class="star-rate">4.5</span>
						<span ng-show="item.num">服务{{item.num}}个客户</span>
					</div>
					<div class="subtitle" style="font-size:0.55rem">
						<div class="store-moneylimit">
						  <span>人均¥{{item.price}}</span>
						  <span class="store-distance"> 服务时间：约{{item.times}}分钟</span>
						</div>
					</div>
                </a>
            </div>
		</div>
		<div ng-show="loading" class='infinite-loading'><span class='fui-preloader'></span><span style="margin-left:1.5rem"> 正在加载...</span></div>
	</div>
</div>
<div class="fui-page order-create-page fui-page-current" ng-if="pagedata.op == 'sever_detail'">
	<div class="fui-content">
		<div class="fui-cell-group" style="margin-top:0">
				<div class="fui-cell">
					<div class="fui-cell-text">
						<div class="text" style="font-size:0.75rem"><i class="icon icon-shoucang"></i> {{pagedata.store.brandname || '无'}}({{pagedata.store.title}}) <i class="icon icon-more"></i></div>
						<div class="subtitle" style="font-size:0.55rem;padding-top:0.5rem">{{pagedata.store.address || '无地址'}},距离您{{pagedata.store.juli || 2.2}}km</div>
					</div>
					<div class="fui-cell-remark noremark">
						<span class="r-icon" href="tel:{{pagedata.store.tel || pagedata.store.mobile}}">
								<i class="icon icon-phone" style="padding:0.3rem;font-size:0.7rem"></i>
						</span>
						<span class="r-icon" style="margin-left:0.6rem" ng-click="pagedata.openLocation(pagedata.store);">
								<i class="icon icon-map" style="padding:0.3rem;font-size:0.7rem"></i>
						</span>
					</div>
				</div>
		</div>
		<div id="carousel-container" class="carousel slide" data-role="carousel" data-param-auto="true">
			<div class="carousel-inner" role="listbox" style="height:6rem">
				<div ng-class="{'item':1,'active':$index==0}" ng-repeat="item in pagedata.serve.hdps">
					<a href="#">
						<img src="{{tomedia(item.picurl) || '../core/resource/images/banner-1.jpg'}}" style="display: block; width: 100%; height: 100%;">
					</a>
				</div>
			</div>
			<style>
					.fui-swipe-page .fui-swipe-bullet {background: {background}; opacity: {opacity};}
					.fui-swipe-page .fui-swipe-bullet.active {opacity: 1;}
			</style>
			<div id="carousel-jinyun" class="fui-swipe-page" style="padding: 0 5px; bottom: 10px; ">
				<div class="fui-swipe-bullet" ng-repeat="item in pagedata.serve.hdps" ng-class="{'active':$index==0}" data-target="#carousel-container" data-slide-to="{{$index}}"></div>
			</div>
		</div>
		<div class="weui_cells weui_cells_form" style="margin-top:0">
			<div class="weui_cell">
				<div class="weui_cell_hd"><label class="weui_label subtitle"><i class="icon jinyunicon icon-gerenzhongxin" ></i> 访问人数 208 <i class="icon jinyunicon icon-yuding" ></i> 已预约18</label></div>
			</div>
		</div>
		<!--<div ng-include="sys_html('common/_sever_stores')"></div>-->
		<div ng-if="pagedata.serve.remark" class="weui_cells_title">项目说明</div>
		<div ng-if="pagedata.serve.remark" class="weui_cells">
			<div class="weui_cell desc">
				{{pagedata.serve.remark}}
			 </div>
		</div>
		<div class="weui_cells_title">预约日期</div>
		<div class="fui-tab-scroll weui_cells_radio3" style="height: 3.6rem;overflow-y:hidden">
			<div class="fui-icon-col" ng-repeat="item in pagedata.data" style="height: 3.2rem">
			    <label class="jyui_cell_col">
					<div ng-class="{'coltime':1,'colchecked':pagedata.post.dayid==$index}" ng-click="getdata(pagedata.serve.id,$index);pagedata.post.dayid=$index;">
						<div class="timetitle"><span>{{item.riqi}}</span></div>
						<div class="timetitle"><span>{{item.xinq}}</span></div>
					</div>
				</label>
				</div>
		</div>
		<div ng-show="pagedata.package" class="weui_cells_title">服务套餐</div>
		<div class="weui_cells weui_cells_radio2">
				<label class="weui_cell weui_check_label dashed" ng-repeat="item in pagedata.package">
					<div class="weui_cell_bd weui_cell_primary">
						<span style="float:left;width:100%">{{item.package_title}}</span>
						<span class="syscolor" style="float:left;">价格：{{item.package_price}}</span>
					</div>
					<div class="weui_cell_ft" ng-click="pagedata.post.packageid=$index;">
						<input type="radio" class="weui_check" name="radio1">
						<span class="weui_icon_checked"></span>
					</div>
				</label>
		</div>
		<div class="weui_cells_title">可预约{{pagedata.diy.worker || '技师'}}</div>
		 <div class="fui-tab-scroll" style="height: 5rem" >
			<div class="xcontainer weui_cells_radio3" style="z-index:0;height: 5.5rem;padding:0.3rem 0.5rem" >
			    <label class="jyui_cell_member" style="width:3.8rem" ng-repeat="item1 in pagedata.worker_list">
					<div class="userimg">
						<img class="img-circle"  ng-src="{{tomedia(item1.headimg) || '../core/resource/images/nopic.jpg'}}" style="width:3.8rem;height:3.8rem">
						<div class="imglogo-check" ng-click="pagedata.post.worker_id=item1.id;" style="margin-left:2.8rem">
							<input type="radio" class="weui_check" name="radio2">
							<span class="weui_icon_checked"></span>
						</div>
					</div>
					<div>
						<span style="font-size:0.6rem">{{item1.name}}</span>
					</div>
				</label>
			</div>
		</div>
		<div class="weui_cells_title">请选择预约时间</div>
		<div class="weui_cells" ng-if="pagedata.serve_time">
			<div ng-repeat="row in pagedata.serve_time" ng-if="row.yuyue > 0 && row.show == 1" class="jy-3">
				<div ng-class="{'yuyue-duan':1,'timeischack':pagedata.post.timeid == $index}" ng-click="pagedata.post.timeid=$index;">
					<div>{{row.times.start}}--{{row.times.end}}</div>
					<div>(剩余{{row.yuyue}}位)</div>
					<div class="clear"></div>
				</div>
			</div>
			<div ng-repeat="row in pagedata.serve_time" ng-if="row.yuyue == 0 || row.show == 0" class="jy-3 disabled">
				<div class="yuyue-duan">
					<div>{{row.times.start}}--{{row.times.end}}</div>
					<div>({{row.show==0?'休息':'约满'}})</div>
					<div class="clear"></div>
				</div>
			</div>
		</div>
		
		
		
		<div class="weui_btn_area">
			 <a class="weui_btn weui_btn_primary" href="javascript:"  ng-click="pagedata.check_buy()">立即预约</a>
		</div>
	</div>
</div>
<script type="text/javascript">
scope.pagedata.get_store=function(lat,lng){
		var store_id=scope.pagedata.post.id
		scope.get('jy_meye/server/get_store/lng='+lng+'&lat='+lat,function(res){
			scope.pagedata.store=res.store;
			scope.$evalAsync();
		});
}
scope.pagedata.openLocation=function(item){
	wx.openLocation({
	latitude: item.lat_lng.lat, // 纬度，浮点数，范围为90 ~ -90
	longitude: item.lat_lng.lng, // 经度，浮点数，范围为180 ~ -180。
		name: item.province+item.city+item.district, // 位置名
		address: item.address, // 地址详情说明
		scale: 20, // 地图缩放级别,整形值,范围从1~28。默认为最大
		infoUrl: '', // 在查看位置界面底部显示的超链接,可点击跳转
		success:function(){
			//alert(1111);
		}
	});
}
if(scope.pagedata.pluginset.dingwei!=1){
	window.scope.location(function(res){
			scope.pagedata.post.address = res.address;
			scope.pagedata.get_store(res.lat_lng.lat,res.lat_lng.lng);
	});
}
scope.pagedata.check_buy=function(){
	var serve_id=scope.pagedata.serve.id
	var worker_id=scope.pagedata.post.worker_id
	if(!worker_id){
		scope.message('请选择技师！');
		return false;
	}
	var store_id=scope.pagedata.post.store_id
	var packageid=scope.pagedata.post.packageid
	var timeid=scope.pagedata.post.timeid
	var dayid=scope.pagedata.post.dayid
	scope.get('jy_meye/server/check_buy/serve_id='+serve_id+'&worker_id='+worker_id+'&store_id='+store_id+'&packageid='+packageid+'&timeid='+timeid+'&dayid='+dayid,function(res){});
}
</script>
<script type="text/javascript">
scope.pagedata.post.dayid = 0;
scope.pagedata.post.packageid = 0;
//scope.pagedata.post.timeid = 0;
</script>
</div>
<div ng-include="sys_html('_footer')"></div>
<script>
	require(['bootstrap', 'hammer'], function($, Hammer){
		$('#carousel-container').carousel();
		var mc = new Hammer($('#carousel-container').get(0));
		mc.on("panleft", function(ev) {
			$('#carousel-container').carousel('next');
		});
		mc.on("panright", function(ev) {
			$('#carousel-container').carousel('prev');
		});
	});
	scope.getdata = function(id,dayid){
		var params1 = {
					'plugin':'jy_meye',
					'action':'server',
					'op':'serve_time',
					'query':'id='+id+'&day='+dayid,
					'data':{},
					'callback':function(data){
							console.log(data)
							if(data.success == 1){
								scope.$apply(function(){
									scope.pagedata.serve_time = data.serve_time;
								});
							}
					}
		}
		scope.post_json(params1);
}

</script>